<!DOCTYPE html>
<html> 
<head> 
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">  
    <title>接口类型信息</title> 
    <link rel="shortcut icon" href="favicon.ico">
	<#import "/common/import.ftl" as import>
    <@import.tableManagerImportCss/>
</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content  animated fadeInRight"> 
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                <h5><font id="ssbm_name"></font>系统设置</h5>
                <div class="ibox-tools">
                </div>
            </div>
            <div class="ibox-content" style="padding-top: 30px;">
                <div class="row form-body form-horizontal m-t">
                	<form class="form-horizontal m-t" id="addInfo">
	                	<div class="col-md-6">
						    <div class="form-group">
						        <label class="col-sm-3 control-label">系统名称：</label>
						        <div class="col-sm-9">
						            <input type="text" name="sysName" id="sysName" class="form-control" placeholder="请输入系统名称" value="${config.sysName}">
						        </div>
						    </div>
						    <div class="form-group">
						        <label class="col-sm-3 control-label">系统版本号：</label>
						        <div class="col-sm-9">
						            <input type="text" name="version" id="version" class="form-control" placeholder="请输入系统版本号" value="${config.version}">
						        </div>
						    </div>
						    <div class="form-group">
						        <label class="col-sm-3 control-label">组织机构：</label>
						        <div class="col-sm-9">
						            <input type="text" id="orgCode" name="orgCode" class="form-control" placeholder="请输入系统超级用户组织机构编号" value="${config.orgCode}">
						        </div>
						    </div>
						    <div class="form-group">
						        <label class="col-sm-3 control-label">设置复检相隔时间（小时）：</label>
						        <div class="col-sm-9">
						            <input type="text" id="sysHour" name="sysHour" class="form-control" placeholder="请设置复检相隔时间" value="${config.sysHour}">
						        </div>
						    </div>
						    <div class="form-group">
						        <label class="col-sm-3 control-label">LOG登陆图：</label>
						        <div class="col-sm-9">
						            <input type="file" name="img" id="img" class="form-control" onchange="javascript:uploadImage(this);">
						            <input type="text" name="logImg" style="display: none;" id="logImg" class="form-control" placeholder="请输入系统版本号" value="${config.logImg}">
						        </div>
						    </div>
						    <div class="form-group">
						        <label class="col-sm-3 control-label">FTP服务器IP地址：</label>
						        <div class="col-sm-9">
						            <input type="text" id="ftpHost" name="ftpHost" class="form-control" placeholder="请输入FTP服务器IP地址" value="${config.ftpHost}">
						        </div>
						    </div>
						    <div class="form-group">
						        <label class="col-sm-3 control-label">FTP服务器端口号：</label>
						        <div class="col-sm-9">
						            <input type="text" id="ftpPort" name="ftpPort" class="form-control" placeholder="请输入系统超级用户组织机构编号" value="${config.ftpPort}">
						        </div>
						    </div>
						    <div class="form-group">
						        <label class="col-sm-3 control-label">FTP用户名：</label>
						        <div class="col-sm-9">
						            <input type="text" id="ftpUserName" name="ftpUserName" class="form-control" placeholder="请输入系统超级用户组织机构编号" value="${config.ftpUserName}">
						        </div>
						    </div>
						    <div class="form-group">
						        <label class="col-sm-3 control-label">FTP密码：</label>
						        <div class="col-sm-9">
						            <input type="text" id="ftpPassword" name="ftpPassword" class="form-control" placeholder="请输入系统超级用户组织机构编号" value="${config.ftpPassword}">
						        </div>
						    </div>
						    <div class="form-group">
						        <label class="col-sm-3 control-label">FTP静态资源访问地址：</label>
						        <div class="col-sm-9">
						            <input type="text" id="ftpUrl" name="ftpUrl" class="form-control" placeholder="请输入系统超级用户组织机构编号" value="${config.ftpUrl}">
						        </div>
						    </div>
						    <div class="form-group">
						        <div class="col-sm-12" style="margin-top: 20px;text-align: right;">
						            <button class="btn btn-primary" type="button" id="saveBut">保存更新</button>
						        </div>
						    </div>
						</div>
						<div class="col-md-6">
							<img src="${config.logImg}" id="showImg" style="height: 50%;width:50%;display: block;margin: 0 auto;">
						</div>
	                </div>
	            </form>
            </div>
        </div>
    </div>
</body>
<@import.tableManagerImportScript/>
<script src="${WEB_PATH}/resources/js/ajaxfileupload.js"></script>
<script>
var fileTypes = "jpg/png/jpeg";
function uploadImage(obj){
     var fileType = $("#logImgFile").val()
		 var index = layer.msg('文件上传中......', {icon: 16,shade: 0.3,time:0});
		 $.ajaxFileUpload({
		 	  type: 'POST',
			  url:'${WEB_PATH}/ports/file/uploadEnclosure.do', 
			  secureuri:false,
			  fileElementId:'img',
			  dataType: "json",
            	success:function(data){ 
            		layer.close(index); 
				    $("#logImg").val(data.data); 
                    $("#showImg").attr("src",data.data);
                    layer.alert(data.msg, {
					  skin: 'layui-layer-molv',
					  closeBtn: 0,
					});
				 },
				 error:function(data){
				 	layer.alert('<font color="red">'+data.msg+'</font>', {
					  skin: 'layui-layer-molv',
					  closeBtn: 0,
					  icon: 5,
					});
				 }
		 });
}


 $(function(){   
    $('#saveBut').click(function(){
    	console.log($("#logImgFile").val());
    	$.ajax({
		  type: 'POST',
		  url: '${WEB_PATH }/system/config/save.do',  
		  data: $('#addInfo').serialize(),
		  dataType: "json",
			 success:function(result){  
			    layer.alert('<font color="#1ab394">'+result.msg+'</font>', {
					  	skin: 'layui-layer-molv',
					  	icon: 1,
					  	closeBtn: 0
				},function(){
					window.location.reload();
				});
			 },
			 error:function(data){
			 	layer.alert('<font color="red">'+data.msg+'</font>', {
				  skin: 'layui-layer-molv' ,
				  closeBtn: 0,
				  icon: 5,
				});
			 }
		});
     });
  });    
  </script>   
</html>